package com.taobao.tbk.controller;

import com.taobao.tbk.dao.BannerDO;
import com.taobao.tbk.dao.CommonNavDO;
import com.taobao.tbk.dao.CommonNavItemDO;
import com.taobao.tbk.service.ConfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/conf")
public class ConfController extends BaseController {

    @Autowired
    private ConfService confService;

    @RequestMapping("/banners")
    @ResponseBody
    public List<BannerDO> getBannerList() {
        List<BannerDO> bannerDOList = confService.getBanners();
        return bannerDOList;
    }

    @RequestMapping("/navs")
    @ResponseBody
    public List<CommonNavDO> getNavList() {
        List<CommonNavDO> commonNavDOList = confService.getCommonNavList();
        return commonNavDOList;
    }

    @RequestMapping("/nav_items")
    @ResponseBody
    public List<CommonNavItemDO> getNavItemList(@RequestParam(name = "nav_id") Integer navId) {
        List<CommonNavItemDO> commonNavItemDOList = confService.getNavItemList(navId);
        return commonNavItemDOList;
    }

}
